#ifndef _DD_BASE_2D_H_
#define _DD_BASE_2D_H_

#include "math/vec2.h"
#include "graphics/graphics.h"



namespace dd 
{

typedef struct _DBG_BUFFER_2D
{
	Graphics*				pGraphics;
	Graphics::Vertex2D*		DataA;
	int						MaxVertC;
	int						CurrentVertC;
	float					Width, Height;
}   DBG_BUFFER_2D;


///////////////////////////////////////////////////////
///	\brief This class is an abstract base class for debug shapes
///////////////////////////////////////////////////////
class PrimitiveBase2D
{
public:
    /**
     * Initialize class
     */
					PrimitiveBase2D();
    /**
     * Destroy class
     */
	virtual			~PrimitiveBase2D();

    /**
     * Render to buffer
     * @param   _pBuffer    Buffer to render into
     */
	virtual void	Render(DBG_BUFFER_2D* _pBuffer)	= 0;

    /**
     * Add line to buffer
     * @param   _pBuffer    Buffer to render into
     * @param   _From       Origin
     * @param   _To         Destination 
     * @param   _Color      Color of line
     */
	void			AddLine(DBG_BUFFER_2D* _pBuffer, const math::Vec2& _From, const math::Vec2& _To, COLOR _Color = ColorRGBA(255, 255, 255)); 

    /**
     * Add vertex to buffer
     * @param   _pBuffer    Buffer to render into
     * @param   _From       Point
     * @param   _Color      Color of line
     */
	void			AddVertex(DBG_BUFFER_2D* _pBuffer, const math::Vec2& _From, COLOR _Color = ColorRGBA(255, 255, 255)); 

    /**
     * Flush buffer to Device as list of lines. 
     * Device is stored inside the _Buffer object
     * @param   _pBuffer    Buffer to render
     */
    void			FlushBuffer(DBG_BUFFER_2D* _pBuffer);

    /**
     * Flush buffer to Device as list of triangles. 
     * Device is stored inside the _Buffer object
     * @param   _pBuffer    Buffer to render
     */
	void			FlushBufferTri(DBG_BUFFER_2D* _pBuffer);
protected:
	COLOR 		m_Color;        /// color of primitive
};

}// End namespace dd


#endif //_DD_BASE_2D_H_